import React from 'react';
import {BrowserRouter, Routes, Route} from 'react-router-dom';

import Admin from './pages/Admin';
import Login from './pages/Login';
import './App.less';
import memoryUtils from './utils/memoryUtils';
import {getUser} from './utils/storageUtils';

// 把本地user信息存到内存中维持登陆
memoryUtils.user = getUser();

/**
 * 主组件
 */
function App(){
  return (
    <BrowserRouter>
      {/*Routes：只匹配一个路由，Route：路由跳转*/}
      <Routes>
        {/*一级路由 主页*/}
        <Route path='/*' element={<Admin/>}></Route>
        {/*一级路由 登录*/}
        <Route path='/login' element={<Login/>}></Route>
      </Routes>
    </BrowserRouter>
  );
}

export default App;
